<template>
	<scroll-view scroll-y="true" class="container_scrollview" :show-scrollbar="false">
		<view class="container">
			<view class="kuang">
				<!-- 个人信息 -->
				<view class="userinfo fl_al">
					<image src="../../static/tx.png" mode=""></image>
					<view class="" @click="login">
						<view class="">
							动物园里喂老虎
						</view>
						<view class="">
							ID:00001
						</view>
					</view>
					<image src="../../static/shezhi.png" @click="shezhi" class="shezhi" mode=""></image>
				</view>
				<!-- tab -->
				<view class="tab fl_ju">
					<view class="tabson">
						<image src="../../static/all.png" mode=""></image>
						<view class="">
							全部订单
						</view>
					</view>
					<view class="tabson">
						<image src="../../static/waimai.png" mode=""></image>
						<view class="">
							外卖订单
						</view>
					</view>
					<view class="tabson">
						<image src="../../static/ziti.png" mode=""></image>
						<view class="">
							自提订单
						</view>
					</view>
				</view>
			</view>

			<!-- 菜单 -->
			<view class="caidan kuang">
				<u-cell-group :border="false">
					<u-cell title="我的优惠券" isLink @click="go" arrow-direction="left">
					</u-cell>
					<u-cell title="社区群" isLink @click="show = true" arrow-direction="left">
					</u-cell>
					<u-cell title="收货地址" @click="dizhi" isLink arrow-direction="left">
					</u-cell>
					<u-cell title="联系客服" @click="show2 = true" isLink arrow-direction="left">
					</u-cell>
				</u-cell-group>

			</view>
		</view>
		<u-popup :show="show" @close="close" :closeOnClickOverlay="true" :round="20" mode="center" @open="open">
			<view class="shequ">
				<view class="">
					扫码加群，点餐更划算
				</view>
				<image src="../../static/my.png" mode=""></image>
				<view class="">
					欢迎添加老板微信
				</view>
				<view class="" style="font-size: 24rpx;margin-top: 20rpx;">
					yc49994431
				</view>
			</view>
		</u-popup>
		<u-action-sheet :actions="list" @close="close" @select="selectClick" :closeOnClickOverlay="true"
			:closeOnClickAction="true" :title="title" :show="show2"></u-action-sheet>
	</scroll-view>
</template>

<script>

	export default {
		data() {
			return {
				title: '联系店家',
				list: [{
					name: '18455050327',
					subname: "电话",
					color: '#3AA3FF',
					fontSize: '20'
				}],
				progress: false,
				columns: [],
				columnsList: [],
				show: false,
				show2: false,
				gongsiname: "",
				hetongList: [],
				gerenjinduList: [],
				activeProcess: 2,
				jinduList: [],
				xiazaiList: [],
				imgHeight: 0, //刘海高度
				creditCode: '',
				jindudata: {},
			};
		},
		computed: {},
		onShow() {

		},
		onLoad() {
			let systemInfo = uni.getMenuButtonBoundingClientRect();
			this.imgHeight = systemInfo.height + systemInfo.top + 5;
		},
		methods: {
			dizhi() {
				uni.navigateTo({
					url: '/pages/user/myAddress'
				})
			},
			login() {
				let that = this;
				//先获取用户的信息
				uni.getUserInfo({
					desc: '登录的数据',
					success(ures) {
						console.log(ures, '返回的用户信息');
						uni.login({
							provider: 'weixin', //使用微信登录
							success(lres) {
								console.log(lres, '请求微信登录返回的数据');
								let params = {
									jscode: lres.code
								};
								//这里需要使用自己封装的接口 loginByWechat
								wxLogin(params).then(res => {
									console.log(res, '微信一键登录返回的数据');
									if (res.data.code == 200) {
										// uni.showToast({
										// 	title: '登录成功',
										// 	//将值设置为 success 或者直接不用写icon这个参数
										// 	icon: 'success',
										// 	//显示持续时间为 2秒
										// 	duration: 2000
										// })
										uni.setStorageSync('token', res.data.msg)
										that.userinfo(res.data.msg)
									}
								});
							}
						})
					}
				})
			},
			userinfo(e) {
				console.log(e)
				userInfo(e).then(res => {
					console.log(res, '用户信息');
					// if (res.data.code == 200) {
					// 	// uni.showToast({
					// 	// 	title: '登录成功',
					// 	// 	//将值设置为 success 或者直接不用写icon这个参数
					// 	// 	icon: 'success',
					// 	// 	//显示持续时间为 2秒
					// 	// 	duration: 2000
					// 	// })
					// 	uni.setStorageSync('token', res.data.msg)
					// 	that.userinfo()
					// }
				});
			},
			shezhi() {
				uni.navigateTo({
					url: '/pages/user/userInfo'
				})
			},
			go() {
				uni.navigateTo({
					url: '/pages/user/coupon'
				})
			},

		}
	};
</script>

<style lang="scss" scoped>
	@import "./index.scss";

	/deep/ .u-cell__body {
		padding: 32rpx 0 !important;
	}

	/deep/ .u-safe-bottom {
		display: none !important;
	}
</style>